$(function(){
    init();
})
var pageNum = 0;
function init(){
    $("#more").remove();
    $.ajax({
        url:server_url + '/rest/staff/myClients.do',
        data:{userId:userid,pageNum:pageNum,ran:Math.random()},
        success:function(data){
            console.log(data)
            if(data.data == null || data.data.length == 0){
                $("#clients").append('<div class="client_box"><p style="text-align: center">没有更多了</p>')
                return ;
            }
            mapIfExist(function(client){
                var html = '<div class="client_box">\
                        <ul>\
                        <li class="color_orange">\
                    <span>姓名：</span>\
                    <p>'+client.supplyname+'</p>\
                    </li>\
                    <li class="">\
                    <span>电话：</span>\
                    <p>'+client.resmobile+'</p>\
                    </li>\
                    <li class="">\
                    <span>公司：</span>\
                    <p>'+client.compname+'</p>\
                    </li>\
                    </ul>\
                    </div>';
                $("#clients").append(html);
            },data.data)
            pageNum++;
            var more =  '<div class="client_box" id="more" onclick="init()"><p style="text-align: center">加载更多</p></div>'
            $("#clients").append(more);
        }
    })
}